<?php
/**
 * Article form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ArticleForm extends BaseArticleForm
{
	public function configure()
	{
  		$this->widgetSchema['title'] = new sfWidgetFormInput(array(),array('style'=>'width:300px'));
		$this->widgetSchema['alias'] = new sfWidgetFormInput(array(),array('style'=>'width:300px'));
		$this->widgetSchema['short'] = new sfWidgetFormTextarea(array(),array('cols'=>100));
		$this->widgetSchema['keywords'] = new sfWidgetFormTextarea(array(),array('cols'=>100));
		$this->widgetSchema['description'] = new sfWidgetFormTextarea(array(),array('cols'=>100));
		$this->widgetSchema['updated_at'] = new sfWidgetFormInputHidden();

		$this->widgetSchema['body'] = new sfWidgetFormTextareaFCK();

		// Setup validators
		$this->validatorSchema['title'] = new sfValidatorString(array('required'=>true));

		$this->validatorSchema->setPostValidator(new sfValidatorDoctrineUnique(array('model'=>'Article','column'=>'alias'),array('invalid'=>'Запись с такой ссылкой существует')));
		$this->setValidator('alias', new sfValidatorRegex(array('pattern'=>'/[^a-zA-Z0-9-_]/', "must_match"=>false)));
		$this->validatorSchema['alias'] = new sfValidatorRegex(array('pattern'=>'/[^a-zA-Z0-9-_]/', "must_match"=>false));
  }
}
